﻿using JetBrains.Annotations;
#if TASKSUPPORT
using System.Threading.Tasks;
#endif
namespace MugenMvvmToolkit.Interfaces.ViewModels
{
    /// <summary>
    ///     Represents the view-model which can handle navigation events.
    /// </summary>
    public interface INavigableViewModel : IViewModel
    {
        /// <summary>
        ///     Called when a page becomes the active page in a frame.
        /// </summary>
        /// <param name="context">
        ///     The specified <see cref="INavigationContext" />.
        /// </param>
        void OnNavigatedTo([NotNull]INavigationContext context);

#if TASKSUPPORT
        /// <summary>
        ///     Called when a page becomes the active page in a frame.
        /// </summary>
        /// <param name="context">
        ///     The specified <see cref="INavigationContext" />.
        /// </param>        
        Task<bool> OnNavigatingFrom([NotNull]INavigationContext context);
#else
        /// <summary>
        ///     Called when a page becomes the active page in a frame.
        /// </summary>
        /// <param name="context">
        ///     The specified <see cref="INavigationContext" />.
        /// </param>        
        IOperationResult<bool> OnNavigatingFrom([NotNull]INavigationContext context);
#endif

        /// <summary>
        ///     Called when a page is no longer the active page in a frame.
        /// </summary>
        /// <param name="context">
        ///     The specified <see cref="INavigationContext" />.
        /// </param>
        void OnNavigatedFrom([NotNull]INavigationContext context);
    }
}